Skip to content

Conversation

ZuseZ4
Copy link
Member

@ZuseZ4 ZuseZ4 commented Oct 6, 2025

LLVM's Metadata is quite fragile. In debug builds we use incremental compilation, which caused the metadata to be dropped. With this change we use named globals instead of metadata to instruct Enzyme how to differentiate functions.
Globals are proper llvm values and thus can't be dropped. Also added an incremental/dbg test which now passes, to unblock the EnzymeAD CI which wants to run Rust autodiff tests.

r? compiler

@rustbot rustbot added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Oct 6, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 6, 2025

r? @nnethercote

rustbot has assigned @nnethercote.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added F-autodiff `#![feature(autodiff)]` S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 6, 2025
@rustbot rustbot assigned fmease and unassigned nnethercote Oct 6, 2025
@ZuseZ4
Copy link
Member Author

ZuseZ4 commented Oct 6, 2025

r? @jieyouxu since you already reviewed my last two test PRs I might as well directly assign you ^^ Thanks! (and please reroll if you're too busy!)

@rustbot rustbot assigned jieyouxu and unassigned fmease Oct 6, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 6, 2025

jieyouxu is currently at their maximum review capacity.
They may take a while to respond.

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jieyouxu
Copy link
Member

jieyouxu commented Oct 7, 2025

You can r=me once tidy is green

@ZuseZ4
Copy link
Member Author

ZuseZ4 commented Oct 7, 2025

@bors r=jieyouxu rollup

@bors
Copy link
Collaborator

bors commented Oct 7, 2025

📌 Commit 6ce845a has been approved by jieyouxu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 7, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 7, 2025
Use globals instead of metadata for std::autodiff

LLVM's Metadata is quite fragile. In debug builds we use incremental compilation, which caused the metadata to be dropped. With this change we use named globals instead of metadata to instruct Enzyme how to differentiate functions.
Globals are proper llvm values and thus can't be dropped. Also added an incremental/dbg test which now passes, to unblock the EnzymeAD CI which wants to run Rust autodiff tests.

r? compiler
bors added a commit that referenced this pull request Oct 7, 2025
Rollup of 7 pull requests

Successful merges:

 - #143900 ([rustdoc] Correctly handle `should_panic` doctest attribute and fix `--no-run` test flag on the 2024 edition)
 - #145608 (Prevent downstream `impl DerefMut for Pin<LocalType>`)
 - #146865 (kcfi: only reify trait methods when dyn-compatible)
 - #147390 (Use globals instead of metadata for std::autodiff)
 - #147398 (Fix; correct placement of type inference error for method calls)
 - #147431 (compiletest: Read the whole test file before parsing directives)
 - #147433 (Fix doc comment)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 7, 2025
Use globals instead of metadata for std::autodiff

LLVM's Metadata is quite fragile. In debug builds we use incremental compilation, which caused the metadata to be dropped. With this change we use named globals instead of metadata to instruct Enzyme how to differentiate functions.
Globals are proper llvm values and thus can't be dropped. Also added an incremental/dbg test which now passes, to unblock the EnzymeAD CI which wants to run Rust autodiff tests.

r? compiler
bors added a commit that referenced this pull request Oct 7, 2025
Rollup of 8 pull requests

Successful merges:

 - #145608 (Prevent downstream `impl DerefMut for Pin<LocalType>`)
 - #146865 (kcfi: only reify trait methods when dyn-compatible)
 - #147205 (Add a new `wasm32-wasip3` target to Rust)
 - #147390 (Use globals instead of metadata for std::autodiff)
 - #147398 (Fix; correct placement of type inference error for method calls)
 - #147422 (collect-license-metadata: Print a diff of the expected output)
 - #147431 (compiletest: Read the whole test file before parsing directives)
 - #147433 (Fix doc comment)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Oct 7, 2025
Rollup of 8 pull requests

Successful merges:

 - #145608 (Prevent downstream `impl DerefMut for Pin<LocalType>`)
 - #146865 (kcfi: only reify trait methods when dyn-compatible)
 - #147205 (Add a new `wasm32-wasip3` target to Rust)
 - #147390 (Use globals instead of metadata for std::autodiff)
 - #147398 (Fix; correct placement of type inference error for method calls)
 - #147422 (collect-license-metadata: Print a diff of the expected output)
 - #147431 (compiletest: Read the whole test file before parsing directives)
 - #147433 (Fix doc comment)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. F-autodiff `#![feature(autodiff)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants